package com.ruoyi.back.domain

import com.baomidou.mybatisplus.annotation.*
import io.swagger.annotations.ApiModel
import io.swagger.annotations.ApiModelProperty
import org.springframework.format.annotation.DateTimeFormat
import java.io.Serializable
import java.util.*
import javax.persistence.*

@TableName("fly_channel_manager")
@ApiModel("渠道参数")
@Entity
@Table(name = "fly_channel_manager")
data class ChannelManager(

    @TableId(type = IdType.AUTO)
    @ApiModelProperty("id 更新的时候需要传递")
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    var id: Long? = null,

    /**
     * 创建人
     */
    @ApiModelProperty(hidden = true)
    var createBy: Long? = 0L,

    /**
     * 创建时间
     */
    @TableField(fill = FieldFill.INSERT)
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(hidden = true)
    var createTime: Date? = null,

    /**
     * 更新人
     */
    @ApiModelProperty(hidden = true)
    var updateBy: Long? = 0L,

    /**
     * 更新时间
     */
    @ApiModelProperty(hidden = true)
    @TableField(fill = FieldFill.UPDATE)
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    var updateTime: Date? = null,

    /**
     * 逻辑删除
     */
    @ApiModelProperty(hidden = true)
    @TableLogic
    var deleted: Int? = 0,

    @ApiModelProperty("渠道名称")
    var name: String? = null,

    @ApiModelProperty("渠道编码")
    var code: String? = null,

    @ApiModelProperty("是否收费")
    var charge: Boolean? = true,

    @ApiModelProperty("功能显示")
    @TableField(exist = false)
    @Transient
    var functionShow: String? = null,

    @ApiModelProperty("更新的时候传递格式参考 functionInfos得字段 这是一个 array类型得json串")
    @TableField(exist = false)
    @Transient
    var functionIds: String? = null,

    @ApiModelProperty("功能消息信息")
    @TableField(exist = false)
    @Transient
    var functionInfos: List<FunctionInfo>? = null
    ): Serializable


@ApiModel("渠道功能信息")
data class FunctionInfo(

    @ApiModelProperty("功能id")
    var functionId: Long? = null,

    @ApiModelProperty("功能名称")
    var functionName: String? = null,

    @ApiModelProperty("多久后 显示 单位秒")
    var delay: Long? = null,
)